﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Authentificated.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="UserManagement_Users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MCPH_Auth" Runat="Server">
<asp:ObjectDataSource ID="odsUser" runat="server"
    TypeName="School.DAL.UserController"
    DataObjectTypeName="School.Entities.User"
    EnablePaging="true"
    MaximumRowsParameterName="maxRowCount"
    StartRowIndexParameterName="startIndex"
    SelectCountMethod="GetCount"
    SelectMethod="SelectAll">
</asp:ObjectDataSource>

<h1>Користувачі</h1>
<asp:Button ID="btnAddUser" runat="server" PostBackUrl="~/UserManagement/UserDetails.aspx" Text="Додати користувача" /><br /><br />
<asp:GridView ID="grvUser" DataSourceID="odsUser" runat="server"  CssClass="UserGridView"
    AllowPaging="true" PageSize="15" 
    AutoGenerateColumns="false">
    <EmptyDataTemplate>
        Немає жодного запису
    </EmptyDataTemplate>
    <Columns>
        <asp:TemplateField HeaderText="Код" SortExpression="UserID">
            <ItemTemplate>
                <%# Eval("UserID") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="ПІП користувача">
            <ItemTemplate>
                <%# Eval("FullName") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Дата народження">
            <ItemTemplate>
            <table width="100%">
                <tr>
                    <td width="100%" align="right"><%# Eval("Birth") %></td>
                </tr>
            </table>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Адреса">
            <ItemTemplate>
                <%# Eval("Address") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Телефон">
            <ItemTemplate>
                <%# Eval("Phone") %>
            </ItemTemplate>
        </asp:TemplateField>        
        <asp:TemplateField HeaderText="Логін">
            <ItemTemplate>
                <%# Eval("Login") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <%--<asp:LinkButton ID="lbtUserDetails" runat="server" PostBackUrl= '<%# String.Format("~/UserManagement/UserDetails.aspx?UserID={0}", Eval("UserID")) %>'  Text="Детально" />--%>
                <asp:HyperLink ID="hlkUserDetails" runat="server" NavigateUrl='<%# String.Format("~/UserManagement/UserDetails.aspx?UserID={0}", Eval("UserID")) %>'  Text="Детально" />
            </ItemTemplate>
        </asp:TemplateField>
        
    </Columns>
</asp:GridView>
</asp:Content>

